/*! \file logparser.h
    \brief This file contains declaration of class ARSARSLogParser.
    \version 1.0
*/

#ifndef __ADMFILEADAPTER
#define __ADMFILEADAPTER

#include <QHash>
#include <QRegExp>
#include <QTextStream>
#include <QDomDocument>
#include <QtPlugin>

#include <dynamicmodel.h>
#include <adapterinterface.h>

/*! \class ADMFileAdapter
    \brief This class is used to convert ARS log to ARSExecModel.
*/
class ADMFileAdapter : public QObject,
                       public DynamicModelAdapterPluginInterface
{
    Q_OBJECT
    Q_INTERFACES(PluginInterface DynamicModelAdapterPluginInterface)

public:
    /*! Constructor. */
    ADMFileAdapter(QObject * parent = 0);

    QString name() const;
    QString description() const;
    bool loadSettings();

    /*! Creates execution model from XML file \a file. */
    DynamicModel * createModel(QIODevice * source);
    static QString model2xml(DynamicModel * model );

private:
    static QDomElement item2xml( const ARSExecItem * item, QDomDocument * document );
    static ARSExecItem * element2item( ObjectsIndex * objectsIndex, const QDomElement & element, ARSExecItem * parent = 0 );
    static QVariant string2Property( ObjectsIndex * objectsIndex, const QString & propertyString,
                                     const QMetaProperty & itemMetaProperty, ARSExecItem * item );
    static ARSExecAction * createAction( ARSExecAction::ActionType type, ARSExecItem * parent );
};

#endif // __ADMFILEADAPTER

////////////////////////////////////////////////////////////////////////////////////////////////////
